/*
 *  Copyright 2019-2025 Zheng Jie
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *  http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */
package cn.com.cdb.ldms.domain;

import cn.com.cdb.ldms.base.BaseEntity;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.io.Serializable;

/**
 * @author jizi
 * @description /
 * @date 2025-06-24
 **/
@Data
@TableName("tool_s3_storage")
@EqualsAndHashCode(callSuper = true)
public class S3Storage extends BaseEntity implements Serializable {

    @TableId(value = "storage_id")
    @Schema(name = "主键")
    private Long id;

    @NotBlank
    @Schema(name = "文件名称")
    private String fileName;

    @NotBlank
    @Schema(name = "真实存储的名称")
    private String fileRealName;

    @NotBlank
    @Schema(name = "文件大小")
    private String fileSize;

    @NotBlank
    @Schema(name = "文件MIME 类型")
    private String fileMimeType;

    @NotBlank
    @Schema(name = "文件类型")
    private String fileType;

    @NotBlank
    @Schema(name = "文件路径")
    private String filePath;

    public void copy(S3Storage source) {
        BeanUtil.copyProperties(source, this, CopyOptions.create().setIgnoreNullValue(true));
    }
}
